package com.ruoyi.web.controller.degree;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.degree.domain.BizSchoolsVideos;
import com.ruoyi.degree.service.IBizSchoolsVideosService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 学校视频Controller
 * 
 * @author ruoyi
 * @date 2025-07-24
 */
@RestController
@RequestMapping("/degree/videos")
public class BizSchoolsVideosController extends BaseController
{
    @Autowired
    private IBizSchoolsVideosService bizSchoolsVideosService;

    /**
     * 查询学校视频列表
     */
    @PreAuthorize("@ss.hasPermi('degree:videos:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizSchoolsVideos bizSchoolsVideos)
    {
        startPage();
        List<BizSchoolsVideos> list = bizSchoolsVideosService.selectBizSchoolsVideosList(bizSchoolsVideos);
        return getDataTable(list);
    }

    /**
     * 导出学校视频列表
     */
    @PreAuthorize("@ss.hasPermi('degree:videos:export')")
    @Log(title = "学校视频", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BizSchoolsVideos bizSchoolsVideos)
    {
        List<BizSchoolsVideos> list = bizSchoolsVideosService.selectBizSchoolsVideosList(bizSchoolsVideos);
        ExcelUtil<BizSchoolsVideos> util = new ExcelUtil<BizSchoolsVideos>(BizSchoolsVideos.class);
        util.exportExcel(response, list, "学校视频数据");
    }

    /**
     * 获取学校视频详细信息
     */
    @PreAuthorize("@ss.hasPermi('degree:videos:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bizSchoolsVideosService.selectBizSchoolsVideosById(id));
    }

    /**
     * 新增学校视频
     */
    @PreAuthorize("@ss.hasPermi('degree:videos:add')")
    @Log(title = "学校视频", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizSchoolsVideos bizSchoolsVideos)
    {
        return toAjax(bizSchoolsVideosService.insertBizSchoolsVideos(bizSchoolsVideos));
    }

    /**
     * 修改学校视频
     */
    @PreAuthorize("@ss.hasPermi('degree:videos:edit')")
    @Log(title = "学校视频", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizSchoolsVideos bizSchoolsVideos)
    {
        return toAjax(bizSchoolsVideosService.updateBizSchoolsVideos(bizSchoolsVideos));
    }

    /**
     * 删除学校视频
     */
    @PreAuthorize("@ss.hasPermi('degree:videos:remove')")
    @Log(title = "学校视频", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizSchoolsVideosService.deleteBizSchoolsVideosByIds(ids));
    }
}
